<template>
  <div id="weight" style="width: 600px;height:400px;"></div>
</template>

<script>
import echarts from "echarts";

export default {
  mounted() {
    const weightChart = echarts.init(document.getElementById('weight'));
    const option = {
      title: {
        text: '体重变化图',
        left: 'center', // 居中对齐
      },
      tooltip: {
        trigger: 'axis'
      },
      xAxis: {
        type: 'category',
        data: ['第一学年', '第二学年', '第三学年', '第四学年']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: [56, 78, 54, 74],
          type: 'line',
          smooth: true,
          label: { // 设置每个点显示数据
            show: true
          },
          lineStyle: { // 设置折线的样式
            color: '#67C23A' // 将折线的颜色设置为红色
          }
        }
      ]
    };
    weightChart.setOption(option)
  }
}
</script>

<style scoped>

</style>
